package models

import (
	"github.com/beego/beego/v2/client/orm"
)

// User struct
type Passagers struct {
	Id          int    `orm:"column(id);auto;size(11)" description:"表ID" json:"id"`
	Avatar      string `orm:"column(avatar);size(255)" description:"作者头像" json:"avatar"`
	Authorname  string `orm:"column(authorname);size(30)" description:"作者名称" json:"authorname"`
	Nickname    string `orm:"column(nickname);size(30)" description:"作者昵称" json:"nickname"`
	Title       string `orm:"column(title);size(30)" description:"文章标题" json:"title"`
	Status      int8   `orm:"column(status);size(1);default(1)" description:"是否启用 0：否 1：是" json:"status"`
	Description string `orm:"column(description);type(text)" description:"文章内容" json:"description"`
	CreateTime  int    `orm:"column(create_time);size(10);default(0)" description:"操作时间" json:"create_time"`
	UpdateTime  int    `orm:"column(update_time);size(10);default(0)" description:"更新时间" json:"update_time"`
	DeleteTime  int    `orm:"column(delete_time);;size(10);default(0)" description:"删除时间" json:"delete_time"`
}

// TableName 自定义table 名称
func (*Passagers) TableName() string {
	return "passagers"
}

// SearchField 定义模型的可搜索字段
func (*Passagers) SearchField() []string {
	return []string{"authorname", "title","nickname", "description"}
}

// NoDeletionId 禁止删除的数据id
func (*Passagers) NoDeletionId() []int {
	return []int{}
}

// WhereField 定义模型可作为条件的字段
func (*Passagers) WhereField() []string {
	return []string{}
}

// TimeField 定义可做为时间范围查询的字段
func (*Passagers) TimeField() []string {
	return []string{}
}

//在init中注册定义的model
func init() {
	orm.RegisterModel(new(Passagers))
}
